<?php if(isset($isInsert) && $isInsert){
?>
<script>
	ajax('listContent','<?php echo $this->params['controller']?>/lists');
	closeBox('addContent','mainContent');
</script>
<?php
}
else{
?>
<fieldset>
    <legend><?php _resource('edit'. $this->params['controller']);?></legend>
<center><div class="message">&nbsp;</div><center>
<?php if($this->Session->read('message')){
	echo '<script>showMessage("addContent","'.$this->Session->read('message').'");</script>';
	$this->Session->delete('message');	
	}?>
<?php if($this->Session->read('error')){
	echo '<script>showMessage("addContent","'.$this->Session->read('error').'",1);</script>';
	$this->Session->delete('error');
}?>
    <form id="adminForm" name="adminForm" method="post" action="<?php echo $this->params['controller']?>/edit/<?php echo $this->data[$uses[0]]['id'].'/'.$locale ?>"  onsubmit="onFormSubmit();return false;">
    <?php
		echo $this->Form->hidden($uses[0].'.id');		
		echo $this->Form->hidden($uses[0].'.view_order');
		echo $this->Form->hidden($uses[0].'.published');
		if($webConfig['is_multi_lang']){
			echo $this->Form->hidden($uses[0].'.defaultcontent');
		}				

	?>
	<table border="0" class="form" style="width:100%">
       	<tr>          
       		<td class="label" align="right" width="100px"><?php _resource('title') ?></td>
       		<td align="left"><?php echo $this->Form->input($uses[0].'.title',array('class'=>'input','label'=>'','size'=>60,'maxlength'=>255));?></td>           
        </tr>
        <tr>          
       		<td class="label" align="right" width="100px"><?php _resource('keycode') ?></td>
       		<td align="left"><?php echo $this->Form->input($uses[0].'.keycode',array('class'=>'input_require','label'=>'','size'=>60,'maxlength'=>255));?></td>           
        </tr>
        
        <tr>          
       		<td class="label" align="right" width="100px"><?php _resource('content') ?>
       		<?php if($webConfig['is_multi_lang']){?>
       		<img class="Tips1" title="<?php echo $listLang[$locale]?>" border="0" src="<?php echo $this->webroot.'img/backend/flag/'.$locale.'.png'?>">
       		<?php }?>
			</td>
       		<td align="left"><?php echo $this->Form->textarea($uses[0].'.content',array('class'=>'','label'=>'','error'=>'','cols'=>120,'rows'=>10));?></td>           
        </tr> 
        <?php if($locale!=$this->Session->read('adminLang') && $webConfig['is_multi_lang']){?>
        	<tr>
            	<td class="label" align="right" width="100px"><?php _resource('content') ?> <img class="Tips1" title="<?php echo $listLang[$this->Session->read('adminLang')]?>" border="0" src="<?php echo $this->webroot.'img/backend/flag/'.$this->Session->read('adminLang').'.png'?>"></td>
            	<td colspan="2"><div style="margin-top: 0px;border: solid 1px #000000;height: 300px; width:710px;overflow: auto"><?php echo $this->data[$uses[0]]['defaultcontent'] ?></div></td>
          	</tr>
        <?php }?>        
        
	</table>
    <div style="width:130px">
          <div class="button"><a onclick="onFormSubmit()" href="javascript:;" title="<?php echo _resource('save') ?>"  > <span class="icon-32-save"> </span></a> </div>         
          <div class="button"><a onclick="resetForm('adminForm')" href="javascript:;" title="<?php echo _resource('reset') ?>"  > <span class="icon-32-back"> </span></a> </div>
          <div class="button"><a onclick="closeBox('addContent','mainContent')" href="javascript:;" title="<?php echo _resource('close') ?>"  > <span class="icon-32-cancel"> </span></a> </div>
    </div>
      </form>
</fieldset>


<script>	
function onFormSubmit(){
	deactivateEditors();
	submitForm('adminForm','addContent');	
}
	activateEditor("<?php echo $uses[0].'Content' ?>");
	scrollTopTo('addContent');		
</script>
<?php } ?>
